var Teacher = {
	init: function() {
		$ajax({
			url: "/newperson/list",
			data: {category:BROADCASTTYPE.TYPE_ENGLISH},
			success: function(res) {
				var items = res.result.results;
				SetLS("tlist", items);
				var html = "";
				var length = items && items.length || 0;
				for (var i=0; i<length; ++i) {
					var photo = items[i].photo && items[i].photo[0] || "../img/icon_teacher.png";
					var phone = CurrentUser.category==30?"电话:"+ items[i].phone:"Phone:" + items[i].phone;
					html += '<div class="ub up_list" ontouchstart="zy_touch()" onclick="Teacher.detail(\''+ i +'\')">'+
					        '    <div class="uw3 uh3 ub_img_cover" style="background-image:url('+ photo +')"></div>'+
					        '    <div class="ub-f1 ub ub-ver upl_p5">'+
					        '        <div class="ub-f1 ub">'+
					        '            <div class="ub-f1 ub_left">'+ items[i].name +'　'+ (items[i].aFrom?items[i].aFrom:'') + ' '+ (items[i].aTo?items[i].aTo:'') +'</div>'+
					        '        </div>'+
					        '        <div class="ub_left ub-f1">'+ phone +'</div>'+
					        '    </div>'+
					        '</div>';
				}
				$("#ctn").html(html);
			}
		});
	},
	detail: function(pos) {
		var tlistItems = GetLS("tlist");
		SetLS("teacher_detail", tlistItems[pos]);
		OpenNewWin("teacher_detail");
	},
	detailInit: function() {
		var data = GetLS("teacher_detail");
		$(".value").each(function(){
			$(this).text(data[$(this).attr("id")]);
		});
		$("#create").text( (new Date(data.create)).pattern('yyyy-MM-dd HH:mm:ss'));
		
		$.each(data.photo,function(i,item){
			$("#photoList").append('<div data-photo="set_bg.png" class="uw100 umauto uptb_p5 photo"><img src="' + Core.id2url(item,"photo") + '" class="uw100"></div>');
		});
	},
}	